<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>@blog.title - @g.site_name</title>
    <link href="@g.bootstrap_css" rel="stylesheet">
    <link href="@g.toastr_css" rel="stylesheet">
    <link href="/static/common.css?@g.start_time" rel="stylesheet">
    <link href="/static/blog.css?@g.start_time" rel="stylesheet">
    @g.statistics
</head>
<body>
@g.navbar
<div class="container col-md-8 col-md-offset-2">

    <h1 class="title">
        @blog.title
        <small class="date">@blog.last_modified</small>
        #if @online != 0:
        <small class="pull-right">
        <a href="/blog/mdf?id=@blog.id" title="编辑"><i class="glyphicon glyphicon-edit text-success"></i></a>　
        <a id="del" href="/blog/del" title="删除"><i class="glyphicon glyphicon-trash text-danger"></i></a>
        </small>
        #end
    </h1>
    <div class="content">
    	@blog.content
		<small class="foot-date">创建于 <span>@blog.created_time</span></small><br />
		<small class="foot-date">最后更新于 <span>@blog.last_modified</span></small><br />
    </div>
    <div class="comment col-md-offset-1 col-md-10">
    	<form action="/comment/add" method="POST" class="ajax">
    		<input name="blog" value="@blog.id" type="hidden" />
    		<div class="input-group">
    		<span class="input-group-addon">昵称</span>
    		<input name="name" placeholder="江湖称号" class="form-control" required />
    		<span class="input-group-addon">密钥</span>
    		<input name="key" placeholder="用于防止别人使用你的昵称" class="form-control" required />
    		</div>
    		<textarea name="comment" class="form-control" placeholder="请不吝赐教!" required></textarea>
    		<input type="submit" class="btn btn-primary pull-right" value="　发　表　" />
    	</form>
    	<br style="clear:both"/>
    	<br style="clear:both"/>
        #for @c in @comments:
		<div class="panel panel-info">
			<div class="panel-heading"><b>@c.guest</b> 在 <i>@c.created_time</i> 写道:</div>
			<div class="panel-body">@c.content</div>
		</div>
        #end
    </div>
</div>
@g.footer
</body>
<script src="@g.jquery_js"></script>
<script src="@g.bootstrap_js"></script>
<script src="@g.toastr_js"></script>
<script src="/static/common.js?@g.start_time"></script>
<script>
    $('#del').click(function(){
        var href = $(this).attr('href');
        if (confirm('确定要删除这篇文章吗？')) {
            $.post(href, 'id=@blog.id', function(){
                top.location.href = '/';
            });
        }
        return false;
    });
    human_datetime('.title small.date');
    human_datetime('small.foot-date span');
    human_datetime('.comment .panel-heading i');
</script>
</html>
